//
//  StrategyParameterSet.m
//  StrategyInspector
//
//  Created by jiro on 12/07/29.
//  Copyright 2012 jiro music. All rights reserved.
//

#import "StrategyParameterSet.h"

#import "StrategyDoubleParameter.h"

int StrategyParameterSet::parameterCount()
{
	return 1;
}

StrategyParameterSet::StrategyParameterSet()
{
}

StrategyParameterSet::StrategyParameterSet( const StrategyParameterSet& s )
{
	const int count = s.getParameterCount();
	strategyParameters.resize( count );
	for ( int i = 0; i < count; i++ )
	{
		strategyParameters[ i ] = s.getParameterAtIndex( i ).copy();
	}
}

StrategyParameterSet::StrategyParameterSet( const std::vector< const char* >& values )
{
	strategyParameters.push_back( new StrategyDoubleParameter( atoi( values[ Id_PrameterIndex ] ) ) );
}

StrategyParameterSet::~StrategyParameterSet()
{
	for ( int i = 0, count = strategyParameters.size(); i < count; i++ )
	{
		delete strategyParameters[ i ];
	}
	strategyParameters.clear();
}


int StrategyParameterSet::getParameterCount() const
{
	return strategyParameters.size();
}

StrategyParameter& StrategyParameterSet::getParameterAtIndex( int index )
{
	return * strategyParameters.at( index );
}

const StrategyParameter& StrategyParameterSet::getParameterAtIndex( int index ) const
{
	return * strategyParameters.at( index ); 
}

int StrategyParameterSet::getParameterIndex() const
{
	return strategyParameters[ 0 ]->getDoubleValue();
}
